<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
</head>
<style>

    .layui-table th, .layui-table td{
        padding: 9px 6px;
        text-align: center;
    }
    .operation-menu a{
        margin: 5px 0;!important;
    }
    .layui-form-item{
        margin-bottom:0px;
    }
    .layui-input-block{
        margin-left: 0px;
        min-height: 0px;
    }
    /*.layui-form select{*/
    /*display: inline-block;*/
    /*}*/
</style>
<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form id="form1" class="layui-form serch" action="{:url('admin/faregoods/index')}" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <input type="text" name="item_id" lay-verify="title" autocomplete="off" placeholder="搜索item_id" class="layui-input layui-btn-sm" value="{if isset($where['item_id'])}{$where['item_id']}{/if}">
                        </div>
                    </div>
                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <input type="text" name="search_name" lay-verify="title" autocomplete="off" placeholder="搜索商品名称" class="layui-input layui-btn-sm" value="{if isset($where['search_name'])}{$where['search_name']}{/if}">
                        </div>
                    </div>
                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <select name="company" id="company">
                                <option value="">请选择合作商</option>
                                {volist name='company' id='v'}
                                <option value="{$v.shortname}"{if isset($where['company'])&&$where['company']==$v['shortname']}selected='selected'{/if}>{$v.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>

                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <button type="reset" class="layui-btn layui-btn-danger layui-btn-sm clear_form">重置</button>
                    <!--<button class="layui-btn layui-btn-danger layui-btn-sm reflush_data">刷新缓存</button>-->
                    <!--<a href="{:url('admin/faregoods/addgoods')}" class="layui-btn layui-btn-sm a_menu">-->
                    <!--新增标品-->
                    <!--</a>-->

                    <!--<a href="{:url('admin/goods/othergoods')}?exportFlag=1" class="layui-btn layui-btn-default layui-btn-sm">导出Excel</a>-->
                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line">
        <colgroup>
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="6%">
            <col width="6%">
            <col width="6%">
            <col width="6%">
            <col width="8%">
            <col width="8%">
            <col width="6%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
            <col width="8%">
        </colgroup>
        <thead>

        <tr>
            <th>商品编号</th>
            <th>itme_id</th>
            <th>略缩图</th>
            <th>商品名称</th>
            <th>合作商</th>
            <!--<th>城市</th>-->
            <th>售卖价（￥）</th>
            <th>采购价（￥）</th>
            <th>商品状态</th>
            <th>更新状态</th>
            <!--<th>预约类型</th>-->
            <!--<th>开始时间</th>-->
            <!--<th>结束时间</th>-->
            <!--<th>发布人员</th>-->
            <!--<th>直订/热门</th>-->
            <th>查询价格</th>
            <!--<th>操作</th>-->
        </tr>
        </thead>
        <tbody>
        {volist name='data' id='v'}
        <tr>
            <td>{$v.fare_goods_id}</td>
            <td>{$v.item_id}</td>
            <td style="text-align: center">
                <img src="{$v['image_cdn_url']}" width="64px">
            </td>

            <td class="">
                <div title="{$v.item_name}" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{$v.item_name}</div>
            </td>
            <td>{$v.company_name}</td>
            <td>{$v.sell_section}</td>
            <td>{$v.usd_price_section}</td>
            <td>{if $v.status==1}可售{else}<span style="color:red">不可售</span>{/if}</td>
            <td>{if $v.is_update==0}无{else}<span style="color:red">有</span>{/if}</td>
            <td>
                <a href="{:url('admin/faregoods/showgoodsdetail')}?id={$v.fare_goods_id}" data="{$v.item_name}" class="layui-btn layui-btn-xs layui-btn-warm showgoodsdetail"  style="margin-right: 0;font-size:12px;background: darkslategrey">查看</a>
                <a href="{:url('admin/faregoods/showgoodsspec')}?id={$v.fare_goods_id}" data="{$v.item_name}" class="layui-btn layui-btn-xs layui-btn-warm showgoodsspec"  style="margin-right: 0;font-size:12px;background:#51a954">套餐</a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$list->render1()}</div>

    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script>

        layui.use('form', function () {
            var form = layui.form;
        });



    </script>
    <script>
        var message;
        layui.config({
            base: '__JS__/',
            version: '1.0.1'
        }).use(['app', 'message'], function() {
            var app = layui.app,
                $ = layui.jquery,
                layer = layui.layer;
            //将message设置为全局以便子页面调用
            message = layui.message;
            //主入口
            app.set({
                type: 'iframe'
            }).init();
        });
    </script>
    <script type="text/javascript">
        layui.use('layer', function(){
            var layer = layui.layer;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                })
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['700px', '680px'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            })

            $('.showgoodsdetail').click(function(){
                var url = $(this).attr('href');
                layer.open({
                    type:2,
                    content:url,
                    area: ['800px', '600px']
                });
                return false;
            })
            $('.showgoodsspec').click(function(){
                var url = $(this).attr('href');
                layer.open({
                    type:2,
                    content:url,
                    area: ['1000px', '600px']
                });
                return false;
            })
            //重置
            $('.clear_form').click(function(){
                $(':input','#form1')
                    .not(':button,:submit,:reset')   //将myform表单中input元素type为button、submit、reset、hidden排除
                    .val('')  //将input元素的value设为空值
                    .removeAttr('checked')
                return false;
            })

            $(".reflush_data").click(function(){
                $.post("/faregoods/refresh",function(data){
                    layer.msg(data.msg);
                })
            })
        });
    </script>

</body>
</html>
